#ifndef DataCore_h
#define DataCore_h

#ifdef WIN_32
#include "esUtil.h"
#else
#include <GLES2/gl2.h>
#endif
#include "ImageDecoder.h"
#include "Sprite.h"
#include "SceneEngine.h"


//define struct for model
struct Texcoord
{
	float u,v;
};

struct Index
{
	int iv, ivt, ivn;
};

struct Position
{
	float x,y,z;
};

struct Model
{
	int numvertices;
	Position *position;
	Texcoord *texcoord;
};

class DataCore
{
private:
	static DataCore* dataCore;

public:

	static DataCore* GetData();

	//convert char ABCDF to number
	int SwitchCharToNumver ( char ch );
	//Ox1006 -> 6 not use 0x1 only conver 006
	int ConvertHexToDec (char* hec );

	void Decode(FILE *fp, ImageData &image);	

	//Load texture for draw 2D
	GLuint LoadTexture2D(char *pngFileName);
	
	//Load one Model 
	Model * LoadModel(const char *filename);

	//Load one Textures for model
    GLuint LoadTexture(char *filename);

	//Load texture for 3D (skydome)
	GLuint LoadTexture3D(char *fPOSITIVE_X, char *fNEGATIVE_X, char *fPOSITIVE_Y, char *fNEGATIVE_Y, char *fPOSITIVE_Z, char *fNEGATIVE_Z);

	//Read level of a scene
	GLint* ReadLevel(char * filename);

	//For sprite
	Sprite* LoadSprite(char *packName);

	//Load gui
	void LoadGui ( char *guiPackName );

	DataCore();
	~DataCore();

};

#endif